package org.stars.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.admin.Admin;
import org.web3j.protocol.geth.Geth;
import org.web3j.protocol.http.HttpService;

/**
 * @author 沧月
 * @date 2021/1/5
 * @desc 描述
 */
@Configuration
public class Web3jConfig {


    @Value("${eth.rinked.url}")
    private String url;

    @Bean
    public Web3j web3j() {
        return Web3j.build(new HttpService(url));
    }

    @Bean
    public Admin admin() {
        return Admin.build(new HttpService(url));
    }

    @Bean
    public Geth geth(){
        return Geth.build(new HttpService(url));
    }
}
